<?php
	require_once('auth.php');
?>
<!DOCTYPE HTML>
<html>

<head>
  <title>MediTrack</title>
  <meta name="description" content="website description" />
  <meta name="keywords" content="website keywords, website keywords" />
  <meta http-equiv="content-type" content="text/html; charset=windows-1252" />
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  
  <link rel="stylesheet" href="style.css" type="text/css" />
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script type="text/javascript" src="chat.js"></script>
    <script type="text/javascript">
    
        // ask user for name with popup prompt    
        var name = prompt("Enter your chat name:", "Guest");
        
        // default name is 'Guest'
    	if (!name || name === ' ') {
    	   name = "Guest";	
    	}
    	
    	// strip tags
    	name = name.replace(/(<([^>]+)>)/ig,"");
    	
    	// display name on page
    	$("#name-area").html("You are: <span>" + name + "</span>");
    	
    	// kick off chat
        var chat =  new Chat();
    	$(function() {
    	
    		 chat.getState(); 
    		 
    		 // watch textarea for key presses
             $("#sendie").keydown(function(event) {  
             
                 var key = event.which;  
           
                 //all keys including return.  
                 if (key >= 33) {
                   
                     var maxLength = $(this).attr("maxlength");  
                     var length = this.value.length;  
                     
                     // don't allow new content if length is maxed out
                     if (length >= maxLength) {  
                         event.preventDefault();  
                     }  
                  }  
    		 																																																});
    		 // watch textarea for release of key press
    		 $('#sendie').keyup(function(e) {	
    		 					 
    			  if (e.keyCode == 13) { 
    			  
                    var text = $(this).val();
    				var maxLength = $(this).attr("maxlength");  
                    var length = text.length; 
                     
                    // send 
                    if (length <= maxLength + 1) { 
                     
    			        chat.send(text, name);	
    			        $(this).val("");
    			        
                    } else {
                    
    					$(this).val(text.substring(0, maxLength));
    					
    				}	
    				
    				
    			  }
             });
            
    	});
    </script>
</head>

<body>
  <div id="main">
    <div id="header">
      <div id="logo">
        <div id="logo_text">
          <!-- class="logo_colour", allows you to change the colour of the text -->
          <h1><a href="main.php">Medi<span class="logo_colour">Track</span></a></h1>
          <h2></h2>
        </div>
      </div>
      <div id="menubar">
        <ul id="menu">
          <!-- put class="selected" in the li tag for the selected page - to highlight which page you're on --> 
		  <li><a href="main.php">Main Menu</a></li>
          <li><a href="Survey.php">Survey</a></li>
          <li class="selected"><a href="doctalks.php">DocTalks</a></li>
          <li><a href="contact.php">Patient Info</a></li>
        </ul>
      </div>
    </div>
    <div id="site_content">
      <div class="sidebar">
		  <h1>Search</h1>
			<form method="post" action="#" id="search_form">
			  <p>
				<input class="search" type="text" name="search_field" value="Currently disabled" />
				<input name="search" type="image" style="border: 0; margin: 0 0 -9px 5px;" src="style/search.png" alt="Search" title="Search" />
			  </p>
			</form>
        <h1>Latest News</h1>
        <h4>Project DocTalks initiated</h4>
        <h5>September 21st, 2011</h5>
        <p>We're happy to be building this site. As you can see, it's in a state of active development and rapidly approaching usability.<br /></p>
        <h1>Useful Links</h1>
        <ul>
          <li><a href="login.php">Login</a></li>
          <li><a href="register.php">Register</a></li>
          <li><a href="logout.php">Logout</a></li>
          <li><a href="contact.php">Contact us</a></li>
        </ul>
      </div>
      <div id="content">
        <h1>Chat app</h1>
        <p>This chat app is currently experimental, so please use the Contact Us form to report any bugs</p>
         
		 <div id="chat-wrap"><div id="chat-area"></div></div>
        <form id="send-message-area">
            <p>Your message: </p>
            <textarea id="sendie" maxlength = '100' ></textarea>
        </form>
		
		</div>
    </div>
    <div id="footer">
      <p><a href="main.php">Home</a> | <a href="Survey.php">A Page</a> | <a href="contact.php">Contact Us</a></p>
      
    </div>
  </div>
</body>
</html>
